<?php
declare (strict_types = 1);

namespace app\admin\controller;

use think\Request;
use app\admin\controller\Common;
use think\facade\View;

class Menu extends Common 
{
	/**
	 * 构造方法
	 */
	public function __construct() {
		parent::__construct();
		$this->title = "菜单";
		$this->model = new \app\admin\model\Menu();
		$this->validate = new \app\admin\validate\Menu();

		/**
		 * 标题
		 */
		View::assign('title',$this->title);

		/**
		 * 模型
		 */
		View::assign('model',$this->model);
		
		/**
		 * 菜单列表
		 */
		$list = $this->model->level();
		$menus = [];
		get_level($list,$menus,'menu_id',0,'id');
		View::assign('menus',$menus);

		/**
		 * 表结构
		 */
		$this->tables = config('tables.menu');
		View::assign('tables',$this->tables);
	}

    /**
     * 显示资源列表
     *
     * @return \think\Response
     */
    public function index()
    {
		return view('index');
    }
}
